package com.yanqu.road.server.manger.union.listener;

import com.yanqu.road.entity.enums.eUnionSyncType;
import com.yanqu.road.entity.union.cross.CrossUnionInfo;
import com.yanqu.road.entity.union.cross.CrossUnionMember;
import com.yanqu.road.server.GameServer;
import com.yanqu.road.server.manger.ICrossUnionSyncListener;
import com.yanqu.road.server.manger.activity.peakseacraft.PeakSeacraftMgr;
import com.yanqu.road.server.manger.activity.unionwar.UnionPhaseWarMgr;
import com.yanqu.road.server.manger.beautyescort.BeautyEscortMgr;

import java.util.List;

/**
 * @Description 巅峰海上争霸
 */
public class PeakSeacraftListener implements ICrossUnionSyncListener {
    @Override
    public void notifySync(int syncType, long playerId, CrossUnionInfo unionInfo, List<CrossUnionMember> memberList) {
        if (syncType == eUnionSyncType.Normal.getValue()) {
            if (unionInfo != null && unionInfo.getServerId() == GameServer.getInstance().getServerId()) {
                PeakSeacraftMgr.synUnionInfo(syncType, unionInfo.getUnionUid(), 0, 0);
            }
        } else if (syncType == eUnionSyncType.SetPosition.getValue()) {
            CrossUnionMember operateMember = memberList.get(0);
            if (operateMember.getServerId() == GameServer.getInstance().getServerId()) {
                PeakSeacraftMgr.synUnionInfo(syncType, unionInfo.getUnionUid(), operateMember.getUserId(), operateMember.getPosition());
            }
        }
    }
}
